﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace DuelQuizzServer.contrats
{
    [ServiceContract(SessionMode = SessionMode.Required, CallbackContract = typeof(IDuelQuizzServiceCallback))]
    public interface IDuelQuizzService
    {
        [OperationContract(IsInitiating = true, IsTerminating = false, IsOneWay = true)] void ServiceConnection();
        [OperationContract(IsInitiating = false, IsTerminating = true, IsOneWay = true)] void ServiceDeconnection();

        #region Questions Actions
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] List<Category> getAllCategories();
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] List<Category> getRandomCategories(int limit);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)] void addCategory(string name, string description);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] Category getCategory(int index);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] List<Question> getQuestionsFromCategory(int category_id, int quantity);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] bool addQuestion(Question question, int category_id);
        #endregion

        #region Users Actions
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)] void createUser(string username, string password, string account_type, string country);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] User login(string username, string password);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] User getUser(int id);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] User getUserWithUsername(string pseudo);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] Notification[] getNotifications();
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)] void creerNotification(int targeted_player, string type);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)] void saveResult(int user_id, int opponent_id, int points);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] Leaderboard getLeaderBoard();
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] bool addFriend(int friend_id);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] User[] getFriends();
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)] void readAllNotifications();
        #endregion

        #region Party Actions
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)] void createParty(string title);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)] void addPlayerToParty(int player_id, int party_id);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)] void removePlayerToParty(int player_id , int party_id);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] User[] getPlayersFromParty(int party_id);
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = false)] Party[] getParties();
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)] void startGame();
            [OperationContract(IsInitiating = false, IsTerminating = false, IsOneWay = true)] void endGame();

        #endregion

    }
}
